package com.jade.zsy.sales.facade.impl;

import com.jade.bss.DbException;
import com.jade.bss.base.customer.Customer;
import com.jade.bss.base.utils.CopyBean;
import com.jade.bss.db.impl.BaseFacadeImpl;
import com.jade.framework.base.lang.StatusException;
import com.jade.zsy.base.common.StatusConstant;
import com.jade.zsy.base.entity.BusinessCode;
import com.jade.zsy.base.entity.Partner;
import com.jade.zsy.base.facade.BusinessCodeFacade;
import com.jade.zsy.base.facade.PartnerFacade;
import com.jade.zsy.sal.enity.SO;
import com.jade.zsy.sal.enity.SODetail;
import com.jade.zsy.sal.service.SODetailFacade;
import com.jade.zsy.sal.service.SOFacade;
import com.jade.zsy.sal.vo.SOVo;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by wq on 2017/6/20.
 */
@Service("SOFacade")
public class SOFacadeImpl extends BaseFacadeImpl implements SOFacade {



    @Transactional
    public SOVo add() throws Exception{
        Customer customer= (Customer) SecurityUtils.getSubject().getPrincipal();
        SO so = new SO();

        so.setOwnerId(customer.getOwnerId());
        so.setCreatorId(customer.getId());
        so.setCreator(customer.getName());
        SOVo soVo  = CopyBean.copy(so,SOVo.class);
        return soVo;
    }
    /**
     * 保存订单
     * @param soVo
     * @throws Exception
     */
    @Transactional
    public void save(SOVo soVo)throws Exception{

    }

    /**
     * 订单失效
     * @param soVo
     * @throws Exception
     */
    @Transactional
    public void disable(SOVo soVo)throws Exception{

    }

    /**
     * 删除订单
     * @param soVo
     * @throws Exception
     */
    @Transactional
    public void delete(SOVo soVo)throws Exception{

    }

    @Transactional
    public void update(SOVo soVo)throws  Exception{
        SO so = CopyBean.copy(soVo,SO.class);
        this.update(so);
    }
}
